// 
// $Rev:: 22            $:  Revision of last commit
// $Author:: rvhaverm@g#$:  Author of last commit
// $Date:: 2010-07-25 1#$:  Date of last commit
// 
package agents.messages;

import agents.agents.MobileServiceAgent;
import agents.agents.Receptionist;
import agents.interfaces.IAgent;
import agents.interfaces.IMessage;

import com.ibm.aglet.Message;

public abstract class BaseMessage implements IMessage
{
    private Message _message;
   
    public BaseMessage()
    {
	_message = createMessage();
    }
    
    public BaseMessage(Message message)
    {
	setMessage(message);
    }
    
    public Message createMessage()
    {
	Class<? extends BaseMessage> className = this.getClass();
	return new Message(className.getName());
    }
    public void setMessage(Message message)
    {
	_message = message;
    }
    
    @Override
    public void sentTo(Receptionist agent){}
    public void sentTo(MobileServiceAgent agent) {}

    @Override
    public final Message getMessage()
    {
	return _message;
    }

}
